package cloneClass;

import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * Created by jyo on 15-11-8.
 */
public class Employee implements Cloneable{
    private String name;
    private double salary;
    private Date hireday;

    public Employee(String name, double salary) {

        this.name = name;

        this.salary = salary;
    }

    public Employee clone() throws CloneNotSupportedException{

        Employee cloned = (Employee) super.clone();

        cloned.hireday = (Date) hireday.clone();

        return cloned;
    }



    public void setHireday(int year,int month,int day){

        Date newHireday = new GregorianCalendar(year,month-1,day).getTime();

//        this.hireday.setTime(newHireday.getTime());
    }

    public void raiseSalary(double byPercent){

        double raise= salary * byPercent / 100;

        salary += raise;

    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", salary=" + salary +
                ", hireday=" + hireday +
                '}';
    }
}
